package com.onec.service.customer.entity.merchant;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.onec.service.api.enums.ProductEnum;
import com.onec.service.api.enums.StatusEnum;
import com.onec.service.api.enums.SystemTypeEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 商户信息变历史表
 * 通道费率信息。
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_merchant_modify")
public class MerchantModify implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Column(name = "version", length = 8)
    @Version
    private Integer version;

    /**
     * 通道编号id
     */
    @Column(name = "merchant_id", length = 16)
    private Long merchantId;

    /**
     * 产品编号
     */
    @Column(name = "product", length = 8)
    @Enumerated(EnumType.STRING)
    private ProductEnum product;

    /**
     * 变更前
     */
    @Column(name = "before_value", length = 64)
    private String beforeValue;


    @Column(name = "after_value")
    private String afterValue;

    /**
     * 创建时间
     */
    @Column(name = "create_time", updatable = false)
    @CreatedDate
    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date createTime;
    /**
     * 创建时间
     */
    @Column(name = "update_time")
    @Temporal(TemporalType.TIMESTAMP)
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date updateTime;
    /**
     * 通道状态
     */
    @Column(name = "status", length = 12)
    @Enumerated(EnumType.STRING)
    private StatusEnum status;
    /**
     * 变更类型
     */
    @Column(name = "type", length = 8)
    @Enumerated(EnumType.STRING)
    private SystemTypeEnum type;
    /**
     * 银行名称
     */
    @Column(name = "creator", length = 64)
    private String creator;
    /**
     * 产品备注
     */
    @Column(name = "remarks", length = 64)
    private String remarks;


}
